<?php
namespace Home\Controller;
use Common\Controller\HomeBaseController;
class HuodongController extends HomeBaseController {
	
	
	protected $db;
	function _initialize(){
		parent::_initialize();

		$this->db=D("Huodong");
	}




	/**
	 *首页
     */
	function index(){




		$count = $this->db->count ();
		$page = $this->page ( $count, 10 );
		$list = $this->db->field("content",true)->limit ( $page->firstRow . ',' . $page->listRows )->order ( array (

			"id" => "DESC"
		) )->select ();


		foreach($list as $k=>$v){


			$return[]=$this->db->get_one($v["id"],$this->u["id"]);








		}



		$this->assign ( "Page", $page->show () );

		$this->assign("_list",$return);


		$this->assign ( "seo_title",  "免费试吃" );


		$this->display ();




	}




	function  show(){

		$id=I('get.id');
		$uid=$this->u["id"];
		$info=$this->db->get_one($id,$uid);




		$info["thumbs"]=explode(',',$info['thumbs']);



		$this->assign ( "seo_title",  $info["title"] );

		$this->assign("info",$info);

		$this->display();


	}





}